import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'mvvm/base_state.dart';

class BaseCoreConfig {
  //创建根布局
  static Widget Function(BaseState, BuildContext) createMainWidgetRoot = (BaseState baseState, BuildContext context) => Container(
        color: baseState.backgroundColor(context),
        child: Theme(
            data: Theme.of(context).copyWith(appBarTheme: context.theme.appBarTheme.copyWith()),
            child: Scaffold(
              backgroundColor: Colors.transparent,
              appBar: baseState.createAppbar(),
              floatingActionButton: baseState.floatingActionButton(),
              resizeToAvoidBottomInset: baseState.resizeToAvoidBottomInset,
              extendBodyBehindAppBar: baseState.extendBodyBehindAppBar,
              body: baseState.buildWidget(context),
            )),
      );

  //创建页面AppBar
  static PreferredSizeWidget? Function(BaseState, BuildContext) createAppbar = (BaseState baseState, BuildContext context) => null;

  //当组件销毁的时候回调
  //类型是 [BaseWidgetState],[BaseViewModel]
  static void Function(dynamic) onDispose = (dynamic obj) {};
}
